<template>
  <div>
    <el-table style="width: 100%" border :data="tableData">
        <el-table-column label="姓名"></el-table-column>
      <template v-for="(item, index) in tableHead">
        <el-table-column
          :prop="item.column_name"
          :label="item.column_comment"
          :key="index"
          v-if="item.column_name != 'id'"
        ></el-table-column>
      </template>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "test",
  data() {
    return {
      tableHead: [
        {
          column_name: "111",
          column_comment: "姓名",
        },
        {
          column_name: "column_age",
          column_comment: "年龄",
        },
        {
          column_name: "column_sex",
          column_comment: "性别",
        },
        {
          column_name: "phone",
          column_comment: "电话",
        },
      ],
      // 表格数据
      tableData: [
        {
          column_age: "3",
          111: "鞠婧祎",
          column_sex: "女",
        },
        {
          column_age: "25",
          111: "魏大勋",
          column_sex: "男",
        },
        {
          column_age: "18",
          111: "关晓彤",
          column_sex: "女",
        },
      ],
    };
  },
};
</script>

